package com.arvin.mapper;

import com.arvin.pojo.Student;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface ClassMapper {

    /**
     * 添加班级
     * @param studentId
     */
    @Insert("insert into t_class(student_id) value (#{studentId})")
    void add(String studentId);

    /**
     * 保存班级信息
     */
    @Update("update t_class set student_id = #{studentId}, year = #{year}," +
            "stu_speciality = #{stuSpeciality},class_number = #{classNumber} " +
            "where student_id = #{oldStudentId}")
    void saveClass(Student student);

    /**
     * 通过学号删除学生班级信息
     * @param studentId
     */
    @Update("delete from t_class where student_id = #{studentId}")
    void deleteByStudentId(String studentId);
}
